// xtensorLearn.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include "xtensor/xarray.hpp"
#include "xtensor/xio.hpp"
#include <xtensor-blas/xlinalg.hpp>

int main()
{
    std::cout << "Hello World!\n";
    xt::xarray<double> arr1
    { {1,2,4},
        {2,5,7.0},
        {2,5,8.0} };
    xt::xarray<double> arr2
    { 5,6,7 };
    xt::xarray<double> res = xt::view(arr1, 0) + arr2;
    std::cout << res;

    xt::xarray<int> arr3{ 1,2,3,4,5,6,7,8,9 };
    arr3.reshape({ 3,3 });
    std::cout << arr3 << std::endl;

    //index access
    std::cout << arr1(0, 0) << std::endl;
    std::cout << arr3(1) << std::endl;

    xt::xarray<double> a = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
    auto d = xt::linalg::det(a);
    std::cout << d << std::endl<<std::endl;  // 6.661338e-16
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
